package com.wxmp.market.zhuli.service.impl;

import com.wxmp.core.util.AjaxResult;
import com.wxmp.core.util.StringUtil;
import com.wxmp.market.zhuli.domain.WxZhuliRedeem;
import com.wxmp.market.zhuli.mapper.WxZhuliBaseInfoDao;
import com.wxmp.market.zhuli.mapper.WxZhuliRedeemDao;
import com.wxmp.market.zhuli.service.WxZhuliRedeemService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("redeemService")
@Transactional
public class WxZhuliRedeemServiceImpl implements WxZhuliRedeemService {

    @Resource
    private WxZhuliRedeemDao redeemDao;

    /**
     * 修改/编辑兑换码
     *
     * @param redeem
     * @return
     */
    @Override
    public AjaxResult redeemEdit(WxZhuliRedeem redeem) {
        if (redeem == null) {

        } else {

        }
        return null;
    }

    /**
     * 新增兑换码信息
     *
     * @param redeemText
     * @param baseCode
     * @return
     */
    @Override
    public AjaxResult redeemAdd(String redeemText, String baseCode) {
        if (StringUtil.isBlank(redeemText)) {
            return null;// 不可为空
        }
        String[] redeems = redeemText.split(",");
        return null;
    }

    @Override
    public WxZhuliRedeem selectAvailableCode(String baseCode) {
        return redeemDao.selectAvailableCode(baseCode);
    }

    @Override
    public void updateAvailableCode(WxZhuliRedeem redeem) {
        redeemDao.updateAvailableCode(redeem);
    }

    @Override
    public List<WxZhuliRedeem> list(WxZhuliRedeem redeem) {
        return redeemDao.list(redeem);
    }
}
